#include <iostream>//Prime.cpp
#include <math.h>
#include "Prime.h"

using namespace std;

void Prime::primef()
{
    int i,j;
    for(i=n1;i<=n2;i++)
    {
        for(j=2;j<=sqrt(i);j++)
        {
            if(0==i%j)
                goto END;
        }
        a[num]=i;
        num++;
        END:;
    }
}

void Prime::show()
{
    cout<<"There are "<<num<<" primes from "<<n1<<" to "<<n2<<'.'<<endl<<endl;
    cout<<"They are:"<<endl;
    int i,counter=0;
    for(i=0;i<num;i++)
    {
        if(5==counter)
        {
            cout<<endl;
            counter=0;
        }
        cout<<a[i]<<' ';
        counter++;
    }
    cout<<endl;
}
